Everything about Spectral Method totally explained
Spectral methods are a class of techniques used in
applied mathematics and
scientific computing to numerically solve certain
partial differential equations, often involving the use of the
Fast Fourier Transform. Where applicable, spectral methods have excellent error properties, with the so called "exponential convergence" being the fastest possible.
Partial differential equations (PDEs) describe a wide array of physical processes such as heat conduction, fluid flow, and sound propagation. In many such equations, there are underlying "basic waves" that can be used to give efficient algorithms for computing solutions to these PDEs. In a typical case, spectral methods take advantage of this fact by writing the solution as its
Fourier series, substituting this series into the PDE to get a system of
ODEs in the time-dependent coefficients of the trigonometric terms in the series (written in complex exponential form), and using a time-stepping method to solve those ODEs.
The spectral method and the
finite element method are closely related and built on the same ideas; the main difference between them is that the spectral method approximates the solution as
linear combination of continuous functions that are generally nonzero over the domain of solution (usually
sinusoids or
Chebyshev polynomials), while the finite element method approximates the solution as a linear combination of piecewise functions that are nonzero on small subdomains. Because of this, the spectral method takes on a
global approach while the finite element method is a
local approach. This is part of why the spectral method work best when the solution is
smooth.
In the finite element community, a method where the degree of the elements is very high or increases as the grid parameter h decreases to zero is sometimes called a
spectral element method.
The implementation of the spectral method is normally accomplished either with
collocation or a
Galerkin approach.
A concrete example
Here we presume a basic understanding of basic multivariate
calculus and
Fourier series. If g(x,y) is a known, complex-valued function of two real variables, and g is periodic in x and y (that is, g(x,y)=g(x+2π,y)=g(x,y+2π)) then we're interested in finding a function f(x,y) so that
»
which is an explicit formula for the Fourier coefficients
aj,k.
To turn this into an algorithm, only finitely many frequencies are solved for. This introduces an error which can be shown to be proportional to
, where
and
is the highest frequency treated.
Algorithm
- Compute the Fourier transform (bj,k) of g.
- Compute the Fourier transform (aj,k) of f via the formula (*) and the Fourier transform of g.
- Compute f by taking an inverse Fourier transform of (aj,k).
Since we're only interested in a finite window of frequencies (of size
n, say) this can be done using a
Fast Fourier Transform algorithm. Therefore, globally the algorithm runs in time
O(
n log
n).
A relationship with the spectral element method
One can show that if
is infinitely differentiable, then the numerical algorithm using Fast Fourier Transforms will converge faster than any polynomial in the grid size h. That is, for any n>0, there's a